<?php defined('SYSPATH') or die('No direct script access.');

class Helper_Default extends Model
{

	static function hash_password($string)
	{
		return md5(md5($string) . 'md5');
	}

	static function hash_time()
	{
		return md5(microtime());
	}

	static function generate_data($date)
	{
		$strtotime = strtotime($date);
		$j = date('j ', $strtotime);
		$F = 'date.month.' . strtolower(date('F', $strtotime));
		$Y = date(' Y ', $strtotime);
		#$l = 'date.week.' . strtolower(date('l', $strtotime));
		$l= '';
		return $j . __($F) . $Y . __($l);
	}

	static function new_name($dir, $name, $type = NULL)
	{
		if ($type == NULL) {
			$type = explode(".", $name);
			$type = strtolower(end($type));
			$name = md5(microtime());
		}
		if (file_exists($dir . $name . '.' . $type))
			return new_name($dir, md5(microtime()), $type);
		return $name . '.' . $type;
	}

	public
	function create_image($image_original, $image_resize, $width, $height)
	{
		Image::factory($image_original)
			->resize($width, $height, Image::AUTO)#HEIGHT
			->save($image_resize);
	}
}

